VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmTrabajosImprenta 
   BackColor       =   &H80000013&
   Caption         =   "Reporte de Trabajos de Imprenta"
   ClientHeight    =   5295
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7830
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5295
   ScaleWidth      =   7830
   Begin VB.CommandButton cmdSalir 
      Caption         =   "Ce&rrar"
      Height          =   855
      Left            =   480
      Picture         =   "frmTrabajosImprenta.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   4200
      Width           =   1335
   End
   Begin VB.CommandButton cmdVer 
      Caption         =   "&Ver"
      Height          =   855
      Left            =   5400
      Picture         =   "frmTrabajosImprenta.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1800
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H80000013&
      Caption         =   "Seleccionar "
      Height          =   3735
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   7215
      Begin VB.CheckBox chkTodos 
         BackColor       =   &H80000013&
         Caption         =   "Todos los clientes"
         Height          =   495
         Left            =   5760
         TabIndex        =   1
         Top             =   480
         Width           =   1215
      End
      Begin MSComCtl2.DTPicker dtpHasta 
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   2400
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         _Version        =   393216
         Format          =   16777217
         CurrentDate     =   39682
      End
      Begin MSComCtl2.DTPicker dtpDesde 
         Height          =   375
         Left            =   2880
         TabIndex        =   3
         Top             =   1560
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         _Version        =   393216
         Format          =   16777217
         CurrentDate     =   39682
      End
      Begin CtaCte.txtCliente txtCliente1 
         Height          =   615
         Left            =   240
         TabIndex        =   0
         Top             =   360
         Width           =   5415
         _ExtentX        =   9551
         _ExtentY        =   1085
      End
      Begin CtaCte.Lista ListaProductos 
         Height          =   3495
         Left            =   240
         TabIndex        =   2
         Top             =   1200
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   6165
      End
      Begin VB.Label Label3 
         BackColor       =   &H80000013&
         Caption         =   "Productos"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000013&
         Caption         =   "Hasta"
         Height          =   255
         Left            =   2880
         TabIndex        =   9
         Top             =   2160
         Width           =   1575
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000013&
         Caption         =   "Desde"
         Height          =   255
         Left            =   2880
         TabIndex        =   8
         Top             =   1320
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmTrabajosImprenta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim nCliDesde, nCliHasta As Integer
Dim cons, codi As String
Private Sub cmdSalir_Click()
Unload Me
End Sub

Private Sub cmdVer_Click()
    nCliDesde = 0
    nCliHasta = 9999
If chkTodos.Value = 0 Then
    nCliDesde = Int(txtCliente1.text)
    nCliHasta = Int(txtCliente1.text)
    rptTrabajosImprenta.Sections.item("ReportHeader").Controls("lblCliente").Caption = "Cliente: " & txtCliente1.Denom
End If

rptTrabajosImprenta.Sections.item("ReportHeader").Controls("rptNombre").Caption = parametro(1)
rptTrabajosImprenta.Sections.item("ReportHeader").Controls("rptDe").Caption = "De: " & parametro(2)
rptTrabajosImprenta.Sections.item("ReportHeader").Controls("lblDesde").Caption = "Periodo Desde: " & Str(dtpDesde.Value)
rptTrabajosImprenta.Sections.item("ReportHeader").Controls("lblHasta").Caption = "Hasta: " & Str(dtpHasta.Value)
codi = ListaProductos.codigos
cons = "SELECT right('0000' + cast(f.fac_puesto as varchar),4)+'-'+right('00000000' + cast(f.fac_numero as varchar) ,8) as fac_numero, fac_fecha, nombreorazonsocial, cuit, abreviatura, "
cons = cons & " (case when pro_denom = ' ' then facd_observ Else: pro_denom end) as pro_denom, "
cons = cons & " right('0000' + cast(facd_puesto as varchar),4)+'-'+right('00000000' + cast(facd_desde as varchar) ,8) as desde, "
cons = cons & " right('0000' + cast(facd_puesto as varchar),4)+'-'+right('00000000' + cast(facd_hasta as varchar),8) as hasta, "
cons = cons & " facd_precio, facd_cantidad, facd_observ "
cons = cons & " FROM factura f, cliente c, condicioniva i, facturadetalle fd, producto p "
cons = cons & " where f.fac_numero = fd.fac_numero AND f.fac_letra = fd.fac_letra AND f.fac_puesto = fd.fac_puesto AND c.id_cliente = f.id_cliente "
cons = cons & " AND c.condicioniva = i.id_condiva AND fd.pro_codigo = p.pro_codigo "
cons = cons & " AND f.fac_fecha >= '" & dtpDesde.Value & "'"
cons = cons & " AND f.fac_fecha <= '" & dtpHasta.Value & "'"
cons = cons & " AND c.id_cliente >= " & Str(nCliDesde)
cons = cons & " AND c.id_cliente <= " & Str(nCliHasta)
cons = cons & " AND p.pro_codigo IN " & codi

Dte.Commands("cmdTrabajosImprenta").CommandText = cons
Dte.Commands("cmdTrabajosImprenta").Execute

rptTrabajosImprenta.Orientation = rptOrientLandscape
rptTrabajosImprenta.Show
rptTrabajosImprenta.Refresh

Dte.rscmdTrabajosImprenta.Close
End Sub



Private Sub chkTodos_Click()
If chkTodos.Value = 1 Then
    txtCliente1.deshabilitar
Else
    txtCliente1.habilitar (True)
End If
End Sub

Private Sub Form_Load()
Me.Height = 5775
Me.Width = 7950
dtpDesde.Value = Date - 30
dtpHasta.Value = Date
chkTodos.Value = 1
ListaProductos.inicializar "SELECT pro_codigo, pro_denom FROM producto"
End Sub

